import request from '@/utils/request'

// 查询航线列表列表
export function listPlans(query) {
  return request({
      url: '/uavTask/task/Planlist',
      method: 'get',
      params: query
  })
}

// 查询机场基本信息列表
export function listDock_info(query) {
  return request({
      url: '/uavTask/task/dockList',
      method: 'get',
      params: query
  })
}



// 查询任务列表
export function listTask(query) {
  return request({
    url: '/uavTask/task/list',
    method: 'get',
    params: query
  })
}

// 查询任务详细
export function getTask(taskId) {
  return request({
    url: '/uavTask/task/' + taskId,
    method: 'get'
  })
}

// 查询任务详细
export function getTaskByDockId(query) {
  return request({
    url: '/uavTask/task/query/',
    method: 'get',
    params: query
  })
}

// 查询任务执行记录列表
export function getTaskExecRecords(query) {
  return request({
    url: `/uavTask/task/execRecord/${query.taskId}`,
    method: 'get',
    params: {
      pageNum: query.pageNum,
      pageSize: query.pageSize
    }
  })
}

// 新增任务
export function addTask(data) {
  return request({
    url: '/uavTask/task',
    method: 'post',
    data: data
  })
}

// 修改任务
export function updateTask(data) {
  return request({
    url: '/uavTask/task',
    method: 'put',
    data: data
  })
}

// 删除任务
export function delTask(taskIds) {
  return request({
    url: '/uavTask/task/' + taskIds,
    method: 'delete'
  })
}

// 暂停任务
export function pauseTask(taskId) {
  return request({
    url: '/uavTask/task/pause/' + taskId,
    method: 'put'
  })
}

// 终止任务
export function stopTask(taskId) {
  return request({
    url: '/uavTask/task/stop/' + taskId,
    method: 'put'
  })
}

// 添加任务执行记录
export function addTaskExecRecord(data) {
  return request({
    url: '/uavTask/task/execRecord',
    method: 'post',
    data: data
  })
}

//根据年月获取任务
export function getMonthlySchedule(params ) {
  return request({
    url: '/uavTask/task/select/monthly',
    method: 'get',
    params: params
  })
}